/**
 * 
 */
package cn.springsoter.core.redis.props;

import java.time.Duration;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;

/**
 * @author kevin
 *
 */
@Data
public class RedisProperties {
	/**
	 * redis架构模式：standalone:单机  replication:主从模式  sentinel:主从哨兵模式  cluster:集群模式  standalone/replication/sentinel/cluster
	 */
	private String architecture;
	private String host;
	private String password;
	private Duration timeout;
	private Integer database;
	/**
	 * 主节点：host:port
	 */
	private String masterHost;
	/**
	 * 从节点：host1:port1,host2:port2,...
	 */
	private String slavesHost;
	
	private JedisConfig jedis;
    private RedisClusterConfig cluster;
    private RedisSentinel sentinel;
    
    /**
	 *  自定义类JedisConfig
	 */
    @Getter
    @Setter
    public static class JedisConfig {
    	private JedisPoolConfig pool;
    }
    
    /**
	 *  自定义类JedisPoolConfig
	 */
    @Getter
    @Setter
    public static class JedisPoolConfig {
    	private int minIdle;
    	private int maxIdle;
    	private int maxActive;
    	private Duration maxWait;
    }
    
    /**
	 *  自定义类RedisClusterConfig
	 */
    @Getter
    @Setter
    public static class RedisClusterConfig {
    	/**
		 * Maximum number of redirects to follow when executing commands across the
		 * cluster.
		 */
		private Integer maxRedirects;
    }
    
    /**
     *  自定义类RedisSentinel
     */
    @Getter
    @Setter
    public static class RedisSentinel {
    	/**
		 * Name of the Redis server.
		 */
		private String master;
    }
}
